// 引用nodejs原生模块
const http = require('http')

// 设定server监听端口
const port = 3000

// 创建http server
const server = http.createServer((req, res) => {
	res.write('hello world')
	res.end()
})

// 启动server
server.listen(port, () => {
	console.log(`server is listen on port ${port}`)
	require('child_process').exec('open http://localhost:3000')
})